﻿using Castle.DynamicProxy;
using CNKI.TPI.Web.Base;
using CNKI.TPI.Web.Interface.Models;
using CNKI.TPI.Web.Search.IBLL;
using CNKI.TPI.Web.Search.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace CNKI.TPI.Web.Interface.Areas.Resource.Controllers
{
    public class GetDocDatabaseListController : BaseApiController
    {        
        private INaviService naviService = null;
        public GetDocDatabaseListController(INaviService naviService)
        {
            this.naviService = generator.CreateInterfaceProxyWithTarget<INaviService>(naviService, new IInterceptor[] { new LogInterceptor() });
        }

        // POST api/getdocdatabaselist
        public void Post([FromBody]string value)
        {
        }

        /// <summary>
        /// 获取文献类数据库列表
        /// </summary>
        /// <returns></returns>
        public object GetDataBaseList()
        {
            OutputEntity result = new OutputEntity();
            try
            {
                IList<SYS_CMS_DATABASE_CLS_NODE> list = naviService.GetDataBaseList();
                if (list != null)
                {
                    result.Status = Status.Success;
                    result.data = list;
                }
                else
                {
                    result.Status = Status.Error;
                }
            }
            catch (Exception ex)
            {
                LogOpr.Error(ex.ToString());
                result.Status = Status.Error;
                result.message = ex.Message;
            }
            return result;

        }
    }
}
